There is the following approach as to software component architecture when developing thereof for the computer system. Normally, the software component consists of a Client and a Server. The Client is a visual shell that is seen by a User of the computer system who interacts with the Client by sending commands. The Server is a service program module that performs a direct execution of the commands sent by the user via the Client. A connection must be established between the Client and Server in order for the Server to be able to receive commands sent via the Client thereto, as well as for the Server to be able to further exchange commands with the Client.
There are two types of the connection between the Server and Client—a synchronous one and an asynchronous one. The synchronous connection or the asynchronous connection has two streams: a rx stream (receiving data, including commands) and a tx stream (transmitting data, including commands). The asynchronous connection allows only a single data stream for each time interval (a cycle): the rx stream only or the tx stream only. In case of the synchronous connection, each rx stream or tx stream is provided separately, i.e. a simultaneous operation of the rx streams and tx streams is possible.
Use of the synchronous and asynchronous connection between the Client and the Server is illustrated on an exemplary computer system that performs a process responsible for printing and executed by the Server, and a process that allows the User to print a file and is executed via the Client. For example, the Client is a text editor via which the User prints a document, while the Server is a service software module Printer Daemon that is provided within the computer system. If the user sends a command to print three documents, the Client (the text editor) will send the following commands to the Server (Printer Daemon): “to print File No. 1”, “to print File No. 2”, “to print File No. 3”. In case of the synchronous connection, the following occurs: the User sends, to the Server, a command to print a document via the Client and receives a response regarding a result of the command execution, as well as receives a direct communication for each document: “File No. 1 has been printed”, “File No. 2 has not been printed, since the paper is out of stock”, “File No. 3 is in a queue”. If the printer is occupied, the Server will send a response that “File No. 1 cannot be printed, since the printer is occupied”.
In the case of the asynchronous connection, the Client sends a command: “to print File No. 1, File No. 2, File No. 3” to the Server and waits for the Server to return the information about the specified files to the Client. Therewith, the Server processes three files simultaneously and, thus, the User may receive a response from the Server about simultaneous execution of the command for all three files. Therewith, the Server's response will not have a direct connection to the files, while the response will be provided randomly. For example, it will not indicate that File No. 1 has not been printed. This makes it necessary to correlate the response of the Server with particular files. As result, if the printer is occupied, the Server will process all three files followed by sending responses to the User's requests in a random order. For example, the User sends documents for printing in the following order: “File No. 1, File No. 2, File No. 3”, while a printing means will receive a response that it is impossible to print the files in random order, such as “File No. 2, File No. 1, File No. 3”.
In case of the asynchronous connection, while the Client waits for information from the Server, it cannot perform a subsequent task. Therewith, a number of messages between the Server and Client is increased, which overloads the connection.
The synchronous connection may be described by the following function:
y=f1(x)
z=f2(y)
result=f3(z)
Therewith, the asynchronous connection may be described by the following function:
f1(x)
wait
y=d1( . . . )
f2(y)
wait
z=d2 ( . . . )
f3(z)
wait
result=d3 ( . . . )
Therefore, creating software components, which operate on the synchronous connection, is much easier, than creating software components, which operate on the asynchronous connection. Therewith, the synchronous connection is faster than the asynchronous connection, since in case of the synchronous connection, the number of the requests to be sent is two times less. A drawback of the synchronous connection lies in that it is not safe. The synchronous connection name is hardcoded in the software component code. The synchronous connection name may be gained by decompiling the software component. If the connection name is available, any unauthorized process may be linked up thereto.
The asynchronous connection is safer, since it operatively comprises a block for filtering incoming processes. Through this, only the Clients that meet a particular set of established parameters are able to request a link-up to the Server. However, the asynchronous connection lacks the above-described advantages of the synchronous connection, namely, a data exchange speed and a simplicity of writing the software code, as compared to the synchronous connection.
Therefore, there is problem of making a choice between the synchronous and asynchronous connection for the inter-process interaction between computer components.